#define quickread
#ifdef quickread
#include <cstdio> 
template <typename T>
inline void read(T& x)
{
    int c=getchar(), f=1; x=0;
    while(c<'0'||'9'<c) {if(c=='-') f=-1; c=getchar();}
    while('0'<=c&&c<='9') 
        x=(x<<3)+(x<<1)+c-'0', c=getchar();
    x*=f;
}
template <typename T>
inline void quickwrite(T x)
{
    if(x<0) putchar('-'), x*=-1;
    if(x>=10) quickwrite(x/10);
    putchar(x%10+'0');
}
#else 
#include <iostream>
#endif
using namespace std;
#define DEBUG
const int N=1e5+10;
int n; int q[N];
void init()
{
    read(n);
    for(int i=1; i<=n; i++) read(q[i]);
}

void debug()
{
    printf("a[]:");
    for(int i=1; i<=n; i++) printf("%d ", q[i]);
    puts("");
}

int Partition(int low, int high)
{
    // printf("Partition(%d, %d)\n", low, high);
    int pivot=q[low];

    while(low<high)
    {
        // printf("(%d, %d)\n", low, high);
        // debug();
        while(low<high&&q[high]>=pivot) --high;
        q[low]=q[high];
        while(low<high&&q[low]<=pivot) ++low;
        q[high]=q[low];
    }
    
    q[low]=pivot;
    // printf("FINISH Partition(%d, %d)\n", low, high);

    return low; 
}

void quick_sort(int low, int high)
{
    // printf("quick_sort(%d, %d)\n", low, high);
    if(low<high)
    {
        int pivotpos=Partition(low, high);
        quick_sort(low, pivotpos-1); quick_sort(pivotpos+1, high);
    }
}

void solve()
{
    init();
    // printf("FINISH CIN\n");
    quick_sort(1, n);
    for(int i=1; i<=n; i++) quickwrite(q[i]), putchar(' ');
    puts("");
}

// #undef DEBUG
signed main()
{
    #ifdef DEBUG
        freopen("./in.txt", "r", stdin);
        // freopen("./out.txt", "w", stdout);
    #endif
    #ifndef quickread
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #endif

    int T=1; //scanf("%d", &T);
    while(T--) 
    {
        solve();
    }
    return 0;
}
